function [lb,ub,dim,fobj] = Get_Functions_details(F)


switch F
    case 'F1'              
        fobj = @F1;
        lb=-50;
        ub=50;
        dim=10;
       
        
    case 'F2'            
        fobj = @F2;
        lb=-10;
        ub=10;
        dim=30;

    case 'F3'
        fobj = @F3;
        lb=-65.536;
        ub=65.536;
        dim=2;
        
    case 'F4'
        fobj = @F4;
        lb=-100;
        ub=100;
        dim=30;
        
    case 'F5'
        fobj = @F5;
        lb=-30;
        ub=30;
        dim=30;
        
    case 'F6'
        fobj = @F6;
        lb=-5;
        ub=20;
        dim=2;     
    case 'F7'       %加了约束项的，罚函数
        fobj = @F7;
        lb=-100;
        ub=100;
        dim=30;
     case 'F8'       %加了约束项的，罚函数
        fobj = @F8;

        lb=[0,0,0];
        ub=[1,1,1];
        dim=3;
    
        case 'F9'       %加了约束项的，罚函数
        fobj = @F9;

        lb=[0,0,0];
        ub=2.*[1,1,1];
        dim=3;
end
end

% F1

function o = F1(x)
o=sum(-x.*sin(sqrt(abs(x))));
end

% F2

function o = F2(x)
o=sum(abs(x))+prod(abs(x));
end


% F3

function o = F3(x)
aS=[-32 -16 0 16 32 -32 -16 0 16 32 -32 -16 0 16 32 -32 -16 0 16 32 -32 -16 0 16 32;,...
-32 -32 -32 -32 -32 -16 -16 -16 -16 -16 0 0 0 0 0 16 16 16 16 16 32 32 32 32 32];

for j=1:25
    bS(j)=sum((x'-aS(:,j)).^6);
end
o=(1/500+sum(1./([1:25]+bS))).^(-1);
end

% F4

function o = F4(x)
o=max(abs(x));
end

% F5

function o = F5(x)
dim=size(x,2);
o=sum(100*(x(2:dim)-(x(1:dim-1).^2)).^2+(x(1:dim-1)-1).^2);

end

% F6

function o = F6(x)
o=(x(2)-(x(1)^2)*5.1/(4*(pi^2))+5/pi*x(1)-6)^2+10*(1-1/(8*pi))*cos(x(1))+10;
end

function o = F7(x)
o=sum(abs((x+.5)).^2);
%加个约束，罚函数，
alpha=10000;
%不等式约束
g1=(x(1)+x(2)^2-x(3)>0)*(x(1)+x(2)^2-x(3))^2*alpha;    
g2=(x(6)^3+x(7)^2+x(8)^3>0)*(x(6)^3+x(7)^2+x(8)^3)^2*alpha;
o=o+g1+g2;
end

function o = F8(x)
    o1=-(x(1)^2-x(2)^2+x(2)*x(3));    %原始目标函数值

    %加个约束，罚函数，不满足约束进行惩罚
    alpha=10000;
    %不等式约束  要化成小于等于
    c(1)=2*x(1)+x(2)+3*x(3)-6;
    c(2)=x(1)^2+x(1)*x(2)+x(3)*x(2)-x(2)-6;
    %等式约束 
    ceq=0;
%  ceq(1)=x(1)+x(3)-1;

    o=o1+alpha*sum((c>0).*c.^2)+alpha*sum(ceq.^2);
end

function o = F9(x)
    o1=-x(1)-2*x(2)+3*x(3);    %原始目标函数值

    %加个约束，罚函数，不满足约束进行惩罚
    alpha=10000;
    %不等式约束  要化成小于等于
    c(1)=-x(1)-x(2)+3;
    c(2)=-x(3)-x(2)+3;
    %等式约束 
    ceq(1)=x(1)+x(3)-4;
%     ceq(1)=x(1)+x(3)-1;

    o=o1+alpha*sum((c>0).*c.^2)+alpha*sum(ceq.^2);
end
